Most portable electronic devices have a dual power supply. Such a dual power supply generally includes a battery pack and an AC adapter. The battery pack is typically embedded inside the electronic device or attached outside the electronic device via a connector.
However, the electronic device is only powered by the battery pack when the AC adapter is not available. As such, if the battery pack is unplugged in order to replace it with another one when the device is in operation, the device will be forced to shut down and any ongoing process will be lost.